---
title: "Highlighting Changes"
---

Highlight changes by flashing or animating cells.

{% gridExampleRunner title="Animated Flashing Cells" name="animated-flashing-cells" /%}

The example above shows changing values:

* Columns A and B use [Flashing Cells](./change-cell-renderers/#flashing-cells).
* Columns C and D use the [Animate Show Change](./change-cell-renderers/#animate-show-changed-cells) cell renderer.
* Columns E and F use the [Animate Slide Cell](./change-cell-renderers/#animate-slide-cells) cell renderer.

## Flashing Cells

You can trigger cells to flash either though the Grid API or by enabling cells to flash when the data changes.

### Enable Flashing on Data Change

Set Column attribute `enableCellChangeFlash=true` to flash the cells when data changes.

{% gridExampleRunner title="Flashing Data Changes" name="flashing-data-changes-coldef" /%}

In the example above:

* All columns have `enableCellChangeFlash=true` so changes to the cell values will flash the cell.
* Clicking **Update Some Data** will randomly update some data. The grid will then flash the cells where data has changed.

To change the length of the effect, use the grid options `cellFlashDuration` and `cellFadeDuration`.

By default, value changes caused by updates to column filters are not highlighted with cell flashing. This behaviour can be toggled by enabling the grid option `allowShowChangeAfterFilter`.

### Flash Cells using the API

Alternatively flash cells using the grid API `flashCells(params)`. The params object takes a list of columns and rows to flash, together with the `flashDuration` and the `fadeDuration` values.

{% apiDocumentation source="grid-api/api.json" section="refresh" names=["flashCells"] /%}

When calling `flashCells()`, pass the `flashDuration` and `fadeDuration` values (in milliseconds) as params to change the duration of cell flashing.

{% gridExampleRunner title="Flashing Data Changes" name="flashing-data-changes" /%}

In the example above, all three buttons use the `flashCells(params)` API. Note the following:

* Clicking **Flash One Cell** uses parameters with one column and one row to flash the intersecting cell.
* Clicking **Flash Two Rows** uses parameters consisting of two row nodes, causing those rows to flash.
* Clicking **Flash Two Columns** uses parameters consisting of two columns, causing those columns to flash.

### Customise Flash Colour

Each time the cell value is changed, the grid adds the CSS class `ag-cell-data-changed` for 500ms by default, and then the CSS class `ag-cell-data-changed-animation` for 1,000ms by default. The grid-provided themes use this to apply a background colour. To override the flash background colour, override the relevant CSS class.

{% gridExampleRunner title="Customising Flashing" name="customising-flashing" /%}

The example above demonstrates customising the flashing cell background colour using the `--ag-value-change-value-highlight-background-color` CSS variable.

## Animated Cell Renderers

Interesting animations for data changes can be achieved using [Cell Components](./component-cell-renderer/). You can create your own or use one of the provided Show Change Cell Components. The grid provides two such components out of the box.

### Animate Show Changed Cells

The difference between the previous and new value is temporarily shown beside the new value and is then faded out. This difference is shown in either green or red, for an increase or decrease in value respectively, alongside an arrow indicating the direction of change.

{% gridExampleRunner title="Animate Show Change Renderer" name="animate-show-change-renderer"  exampleHeight=530 /%}

The example above demonstrates the following:

* Columns A, B are editable.
* Columns C and D are updated via clicking the button.
* Changes to any of the first 4 columns results in animations in the Total and Average column.
* This can be set as a cell renderer in the column definitions:

```{% frameworkTransform=true spaceBetweenProperties=true %}
const gridOptions = {
    columnDefs: [
        // set the cell renderer in the column definition
        { cellRenderer: "agAnimateShowChangeCellRenderer" },
    ]
}
```

### Animate Slide Cells

The previous value is shown in a faded fashion and slides, giving a ghosting effect as the old value fades and slides away.

{% gridExampleRunner title="Animate Slide Renderer" name="animate-slide-renderer"  exampleHeight=530 /%}

The example above demonstrates the following:

* Columns A, B are editable.
* Columns C and D are updated via clicking the button.
* Changes to any of the first 4 columns results in animations in the Total and Average column.
* This can be set as a cell renderer in the column definitions:

```{% frameworkTransform=true spaceBetweenProperties=true %}
const gridOptions = {
    columnDefs: [
        // set the cell renderer in the column definition
        { cellRenderer: "agAnimateSlideCellRenderer" },
    ]
}
```
